FROM registry.cn-beijing.aliyuncs.com/bangying/openjdk:alpine3.14.3-jdk8-maven3.6 as BUILD
COPY settings.xml /root/.m2/settings.xml
WORKDIR /opt/app
COPY pom.xml pom.xml
RUN mvn dependency:go-offline -B
COPY src /opt/app/src
RUN rm -rf /root/.m2/repository/com/univer
RUN mvn clean package -Dmaven.test.skip=true

FROM  registry.cn-beijing.aliyuncs.com/bangying/openjdk:jdk8-alpine

RUN apk add --no-cache tini  font-adobe-100dpi ttf-dejavu fontconfig 

COPY --from=BUILD /opt/app/target/*.jar /opt/app/app.jar
## 添加 arthas 排查java工具
COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas

WORKDIR /opt/app
EXPOSE 9091

## 添加tini，使java进程不成为id为1的进程
# ENTRYPOINT ["/sbin/tini", "--"]
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

CMD java $JVM_OPTS -jar app.jar
